// swiper
var swiper = new Swiper(".mySwiper", {
    spaceBetween: 30,
    centeredSlides: true,
    autoplay: {
        delay: 2500,
        disableOnInteraction: false,
    },
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    },
    navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
    },
});
//云服务
function api() {
    let lis = document.querySelectorAll('.api-item');
    lis.forEach(function(li, index) {
        li.addEventListener("mouseenter", function() {
            this.style.backgroundColor = '#1271ef';
            let i = index + 1;
            i = i < 10 ? "0" + i : i;
            // this.style.backgroundImage = `url(./images/api${index+1<10?"0"+(index+1):index+1}-c.svg)`
            this.style.backgroundImage = `url(./images/api${i}-c.svg)`

        })
        li.addEventListener("mouseleave", function() {
            this.style.backgroundColor = '#fff'
            this.style.backgroundImage = `url(./images/api${index+1<10?"0"+(index+1):index+1}.svg)`
        })

    })
}
api()
    //行业巨头
let index = 0;
let items = document.querySelectorAll(".help-item");
let timeId = setInterval(function() {
    items[index].classList.remove('active');
    index++;
    if (index === 3) {
        index = 0;
    }
    items[index].classList.add('active')

}, 1000)

//合作伙伴
let teams = document.querySelectorAll(".team");
teams.forEach(function(team, index) {
    team.addEventListener('mouseenter', function() {
        let i = index + 1;
        i = i < 10 ? "0" + i : i;
        this.style.backgroundImage = `url(./images/partner${i}-c.svg)`
        this.style.backgroundSize = "100% 100%"
    })
    team.addEventListener('mouseleave', function() {
        let i = index + 1;
        i = i < 10 ? "0" + i : i;
        this.style.backgroundImage = `url(./images/partner${i}.svg)`
        this.style.backgroundSize = "auto"
    })

})

// let login = document.querySelector('.login')
// generateLogin(mask)
// login.addEventListener('click', function() {
//     mask.style.display = 'block'
// })
let login = document.querySelector('.login')
login.addEventListener('click', function() {
    location = './login.html'
})